<?php
	session_start();

	// Requirements and Includes
	/* Controllers */
	require_once("Control\LoginController.php");
	require_once("Control\RegisterController.php");
	require_once("Control\MasterController.php");
	require_once("Control\UserIsLoggedInController.php");
	require_once("Control\ProfileController.php");
	require_once("Control\MessageController.php");
	/* Models */
	require_once("Model\LoginHandler.php");
	require_once("Model\UserHandler.php");
	require_once("Model\RegisterHandler.php");
	require_once("Model\ProfileHandler.php");
	require_once("Model\MessageHandler.php");
	/* Views */
	require_once("View\LoginView.php");
	require_once("View\RegisterView.php");
	require_once("View\UserView.php");
	require_once("View\UserIsLoggedInView.php");
	require_once("View\NavigationView.php");
	require_once("View\ProfileView.php");
	require_once("View\MessageView.php");
	/* Database */
	require_once("Database\DBConnection.php");
	require_once("Database\DBSettings.php");
	/* ErrorHandling */
	require_once("ErrorHandling\Error.php");
	require_once("ErrorHandling\Log.php");
	require_once("ErrorHandling\LogView.php");	
	/* Other */
	require_once("Validation\Validation.php");
	require_once("EncryptionConfig.php");
	require_once("User.php");
	require_once("Profile.php");
	require_once("Message.php");
	
	// Create the loggView
	$logView = new LogView();
	
	// Create the connection to the database
	$con = new DBConnection();
	
	// Connect to the database
	$con->Connect();
	
	// Create the title
	$title = "Webproject - Selania.se";

	// Create the body.
	$body = "";
	
	$masterController = new MasterController($con);
	$body .= $masterController->DoControl();
	
	// Add all errors to the body.
	$body .= $logView->ShowMessages();
	$body .= "</div></div>";

	// Close the connection to the database
	$con->Close();
	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://w3.org/1999/xhtml">
	<head>
		<title>
			<?php
				// Echo out the title.
				echo $title;
			?>
		</title>
		<link rel="stylesheet" type="text/css" href="Style.css" />
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	</head>
	<body>
	<?php
		// Echo out the body.
		echo $body;
	?>
	</body>
</html>